// 用户表单数据库操作
package mapper

import (
	"github.com/golang/glog"
	"pass-config/dao/models"
	"pass-config/database"
)

// 插入新用户
func UsrInsert(usr *models.PassConfigUsr) error {
	err := database.DB.Create(usr).Error
	if err != nil {
		glog.Error("InsertUsr Error")
		return err
	}
	return nil
}

// 查找用户
func UsrFind(username string) *models.PassConfigUsr {
	rusr := models.PassConfigUsr{}
	database.DB.Where("username = ?", username).Find(&rusr)
	return &rusr
}
